﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



using System.Drawing;

using Kitware.VTK;


namespace HAVTKPack
{

    public class VectorFilter : GeometryFilter
    {

        #region 构造函数


        public VectorFilter(string id, HydrolicGrid hg, List<int[,]> iBound, Vector [,,] cellVectorData)
            :base(id)
        {

            this.InitialData(hg, iBound, cellVectorData);


        }


        public VectorFilter(string id, HydrolicGrid hg, List<int[,]> iBound, Vector[, ,] cellVectorData, VectorSetup vectorSetup)
            : base(id)
        {

            this.InitialData(hg, iBound, cellVectorData, vectorSetup);
   
        }


        #endregion

        #region 字段属性


        int _cellRowNum;

        int _cellColNum;

        int _cellLayerNum;


        HydrolicGrid _hg;
        /// <summary>
        /// 不规则网格数据源
        /// </summary>
        public HydrolicGrid Hg
        {
            get { return _hg; }
            set
            {

                _hg = value;

                this.OnSetHydrolicGrid();

            }
        }





        List<int[,]> _ibound;
        /// <summary>
        /// 
        /// </summary>
        public List<int[,]> Ibound
        {
            get { return _ibound; }
            set { 

                _ibound = value;

                this.OnSetIBoundChanged();

            }
        }



        Vector[, ,] _cellVectorData;
        /// <summary>
        /// 
        /// </summary>
        public Vector[, ,] CellVectorData1
        {
            get { return _cellVectorData; }
            set {
                
                _cellVectorData = value;

                this.OnSetVectorDataChanged ();
            
            }
        }


        VectorSetup _vectorSetup;
        /// <summary>
        /// 
        /// </summary>
        public VectorSetup VectorSetup
        {
            get { return _vectorSetup; }
            set { 
                
                
                _vectorSetup = value;

                this.OnSetVectorSetup();

            }
        }


        Vector scaleVector = new Vector(1, 1, 1);

        public Vector ScaleVector
        {
            get { return scaleVector; }
            set { 
                
                scaleVector = value;

                this.OnSetTransformVector();

            }
        }

      

        private double ZPointCoorScale
        {
            get {

                if (this.scaleVector.Z > 0)
                {
                    return (1.0 / this.scaleVector.Z);
                }
                else if (this.scaleVector.Z == 0)
                {
                    return (0.0);
                }
                else
                {
                    return (1.0);
                }

            }

            //set { _zPointCoorScale = value; }


        }





        #endregion

        #region vtk流水线对象

        vtkPolyVertex aPolyVertex;


        vtkUnstructuredGrid _unGrid;



        vtkTransform _transform;
        vtkTransformFilter _transformFilter;

        vtkArrowSource arrowSource;


        vtkGlyph3D glyph3d;


        vtkDataSetMapper mapper;


        vtkActor vectorActor;


        #endregion

        public override void Render()
        {


            //this._unGrid = (vtkUnstructuredGrid)this.ParentNode.Geometry.OutPutData;


            if (_unGrid == null)
            {
               //构建新的

                _unGrid = vtkUnstructuredGrid.New();

             }


            aPolyVertex = vtkPolyVertex.New();



            this.SetUnGridPointCellData();



            if (this._transform ==null )
            {
                this._transform = vtkTransform.New();
            }

            _transform.Identity();
            _transform.Scale(this.scaleVector.X, this.scaleVector.Y, this.scaleVector.Z);



            if (this._transformFilter==null )
            {
                this._transformFilter = vtkTransformFilter.New();
            }


            _transformFilter.SetInput(this._unGrid );
            _transformFilter.SetTransform(_transform);



            arrowSource = vtkArrowSource.New();

            if (this.VectorSetup != null)
            {
                arrowSource.SetTipResolution(this.VectorSetup.TipResolution);
                arrowSource.SetTipRadius(this.VectorSetup.TipRadius);
                arrowSource.SetTipLength(this.VectorSetup.TipLength);
                arrowSource.SetShaftResolution(this.VectorSetup.ShaftResolution);
                arrowSource.SetShaftRadius(this.VectorSetup.ShaftRadius);
            }
            else
            {
                arrowSource.SetTipResolution(6);
                arrowSource.SetTipRadius(0.1);
                arrowSource.SetTipLength(0.35);
                arrowSource.SetShaftResolution(6);
                arrowSource.SetShaftRadius(0.03);

            }




            //vtkThreshold threshold = vtkThreshold.New();
            //threshold.SetInput(_unGrid );
            //threshold.AllScalarsOn ();
            //threshold.SetAttributeModeToUseCellData();
        


           
            glyph3d = vtkGlyph3D.New();

      

            //glyph3d.SetInput(_unGrid);
            glyph3d.SetInput(_transformFilter.GetOutput ());

            glyph3d.SetSource(arrowSource.GetOutput());



            this.SetVectorModle();



            mapper = vtkDataSetMapper.New();
 
            mapper.SetInput(glyph3d.GetOutput());


            mapper.ScalarVisibilityOff();
       



            vectorActor = vtkActor.New();

 
            vectorActor.SetMapper(mapper);


            if (this._repType == REPRESENTATIONTYPE.POINT)
            {
                vectorActor.GetProperty().SetRepresentationToPoints();
            }
            else if (this._repType == REPRESENTATIONTYPE.SURFACE)
            {
                vectorActor.GetProperty().SetRepresentationToSurface();
            }
            else if (this._repType == REPRESENTATIONTYPE.WIREFRAME)
            {
                vectorActor.GetProperty().SetRepresentationToWireframe();
            }


            if (VectorSetup != null)
            {
                vectorActor.GetProperty().SetColor(this.VectorSetup.Color.R / 255.0, this.VectorSetup.Color.G / 255.0, this.VectorSetup.Color.B / 255.0);
            }
            else
            {
                vectorActor.GetProperty().SetColor(1, 0, 0);
            }


            if (this.Visiability ==true  && this.CellVectorData1 != null)
            {
                vectorActor.VisibilityOn();
            }
            else
            {
                vectorActor.VisibilityOff ();
            }


            //if (this._visiability)
            //{
            //    vectorActor.VisibilityOn();
            //}
            //else
            //{
            //    vectorActor.VisibilityOff();
            //}


            this.ParentNode.Scene.VtkControl.RenderWindow.GetRenderers().GetFirstRenderer().AddActor(vectorActor);


            //throw new NotImplementedException();
        }

        public override void StopRender()
        {


            if (this.vectorActor != null)
            {
                this.ParentNode.Scene.VtkControl.RenderWindow.GetRenderers().GetFirstRenderer().RemoveActor(vectorActor);
                this.vectorActor.Dispose();
            }

            if (this.mapper != null)
            {
                this.mapper.Dispose();
            }

            if (this.glyph3d != null)
            {
                this.glyph3d.Dispose();
            }


            if (this.arrowSource != null)
            {
                this.arrowSource.Dispose();
            }

            if (this._unGrid != null)
            {
                this._unGrid.Dispose();
            }


            if (this.ParentNode.Geometry.OutPutData != null)
            {
                this.ParentNode.Geometry.OutPutData.Dispose();
            }


            //throw new NotImplementedException();


        }


        #region 属性改变方法

        /// <summary>
        /// HG
        /// </summary>
        private void OnSetHydrolicGrid()
        {
            if (this.ParentNode == null)
            {
                return;
            }

            if (!this.ParentNode.Scene.IsRendering)
            {
                return;
            }



            this.SetUnGridPointCell();




        }


        /// <summary>
        /// IBound   注意VectorData的值（是否为null）
        /// </summary>
        private void OnSetIBoundChanged()
        {
            if (this.ParentNode == null)
            {
                return;

            }

            if (!this.ParentNode.Scene.IsRendering)
            {
                return;

            }
            this.SetUnGridIBound();




        }

        /// <summary>
        /// VectorData   注意可见性的变换
        /// </summary>
        private void OnSetVectorDataChanged()
        {
            if (this.ParentNode == null)
            {
                return;

            }

            if (!this.ParentNode.Scene.IsRendering)
            {
                return;

            }


            this.SetUnGridCellVectorData();

        }


        /// <summary>
        /// Setup    注意isShowVector的标志改变this.Visibility
        /// </summary>
        private void OnSetVectorSetup()
        {
            if (this.ParentNode == null)
            {
                return;

            }

            if (!this.ParentNode.Scene.IsRendering)
            {
                return;

            }

            this.SetVectorSetup();
        }

        /// <summary>
        /// Scale   还要记得缩放点的向量的z坐标
        /// </summary>
        private void OnSetTransformVector()
        {
            if (this.ParentNode == null)
            {
                return;

            }

            if (!this.ParentNode.Scene.IsRendering)
            {
                return;

            }

            if (this._transform == null)
            {
                return;
            }

            if (this._transform != null)
            {
                this._transform.Identity();
                this._transform.Scale(this.scaleVector.X, this.scaleVector.Y, this.scaleVector.Z);
            }

            if (this._unGrid != null)
            {
                SetUnGridCellVectorData();
            }



        }


        #endregion




        #region 内部方法

        private void InitialData(HydrolicGrid hg, List<int[,]> iBound, Vector[, ,] cellVectorData)
        {


            this._hg = hg;


           int cellRowNum=hg.NRows ;
   
           int cellColNum=hg.NCols ;

           int cellLayerNum = hg.NLayers ;


            if (cellRowNum <= 0)
            {
                cellRowNum = 1;
                this._cellRowNum = cellRowNum;
            }
            else
            {
                this._cellRowNum = cellRowNum;
            }


            if (cellColNum <= 0)
            {
                cellColNum = 1;
                this._cellColNum = cellColNum;
            }
            else
            {
                this._cellColNum  = cellColNum;
            }



            if (cellLayerNum <= 0)
            {
                cellLayerNum = 1;
                this._cellLayerNum = cellLayerNum;
            }
            else
            {
                this._cellLayerNum  = cellLayerNum;
            }


            if (iBound == null)
            {
                this._ibound = new List<int[,]>();

                for (int i = 0; i < cellLayerNum; i++)
                {
                    int[,] ibound = new int[cellRowNum, cellColNum];

                    this._ibound.Add(ibound);

                }

            }
            else
            {
                this._ibound = iBound;
            }

            //if (cellVectorData == null)
            //{

            //    this._cellVectorData = new Vector[cellRowNum, cellColNum, cellLayerNum];

            //    for (int layer = 0; layer < cellLayerNum; layer++)
            //    {
            //        for (int row = 0; row < cellRowNum; row++)
            //        {
            //            for (int col = 0; col < cellColNum; col++)
            //            {
            //                Vector vector = new Vector(0, 0, 0);
            //                //Vector vector = new Vector(1+row , 1+col ,row*col+col  );
            //                _cellVectorData[row, col, layer] = vector;

            //            }
            //        }
            //    }

            //}
            //else
            //{
            //    this._cellVectorData = cellVectorData;
            //}

            this._cellVectorData = cellVectorData;


        }


        private void InitialData(HydrolicGrid hg, List<int[,]> iBound, Vector[, ,]  cellVectorData, VectorSetup vectorSetup)
        {

            InitialData(hg,iBound,cellVectorData );

            if (vectorSetup == null)
            {
                this._vectorSetup = new VectorSetup();
            }
            else
            {
                this._vectorSetup = vectorSetup;
            }

            if (this.VectorSetup.IsShowVector == true)
            {
                this._visiability  = true;//不会触发属性改变事件
            }
            else
            {
                this._visiability = false;
            }


        }






        /// <summary>
        /// HydrolicGrid的变化  Point  Cell
        /// </summary>
        private void SetUnGridPointCell()
        {
           

            if (this._ibound == null)
            {
                return;
            }

            try
            {
                if (this._unGrid == null)
                {
                    this._unGrid = vtkUnstructuredGrid.New();
                }


                //int nLayer = this._hg.NLayers;
                //int nCol = this._hg.NCols ;
                //int nRow = this._hg.NRows ;
                //int nPts = nLayer * nCol * nRow;

                #region  构造数据集

                vtkPolyVertex aPolyVer = vtkPolyVertex.New();

                vtkFloatArray array = vtkFloatArray.New();

                array.SetNumberOfComponents(3);
                //array.SetNumberOfComponents(4);

                int m = 0;

                Coordinate coord;

                for (int layer = 0; layer < this.Ibound .Count ; layer++)
                {
                    for (int row = 0; row < Ibound [layer ] .GetLength (0); row++)
                    {
                        for (int col = 0; col < Ibound [layer ].GetLength (1); col++)
                        {

                            if (this.Ibound [layer ][row,col ]!=0)
                            {

                                coord = this._hg.Coords[row, col, layer];

                                array.InsertNextTuple3 ( coord.X, coord.Y, coord.Z);
                                //array.InsertNextTuple4(m, coord.X, coord.Y, coord.Z);

                                //aPolyVer.GetPointIds().SetId(m,m);
                                aPolyVer.GetPointIds().InsertId(m, m);
                                //aPolyVer.GetPointIds().InsertNextId ( m);

                                m++;
                                
                            }

                        }
                        
                    }
                }

                //array.SetNumberOfTuples(m);

                //aPolyVer.GetPointIds().SetNumberOfIds(m);

                vtkPoints pts = vtkPoints.New();

                pts.SetData(array);

                #endregion


                _unGrid .SetPoints(pts);

         
                _unGrid.InsertNextCell(aPolyVertex.GetCellType(), aPolyVer.GetPointIds());


                _unGrid.Modified();
           

        
            }
            catch 
            {
                System.Windows.Forms.MessageBox.Show("构建网格数据 SetUnGridPointCell() 时出错！");

                return;
            }

          



        
        }

        /// <summary>
        /// 根据VectorData数据  设置cell的data
        /// </summary>
        private void SetUnGridCellVectorData()
        {
            
            if (this._ibound == null)
            {
                return;
            }
            if (_unGrid==null )
            {
                return;
            }
            try
            {

                if (this._cellVectorData != null)
                {

                    vtkFloatArray vectorArray = vtkFloatArray.New();


                    vectorArray.SetNumberOfComponents(3);
                    //vectorArray.SetNumberOfComponents(4);


                    int m = 0;


                    if (CellVectorData1.GetLength(2) == Ibound.Count)
                    {

                        for (int layer = 0; layer < _cellLayerNum; layer++)
                        {
                            for (int row = 0; row < _cellRowNum; row++)
                            {
                                for (int col = 0; col < _cellColNum; col++)
                                {

                                    if (this._ibound[layer][row, col] != 0)
                                    {


                                        vectorArray.InsertNextTuple3(CellVectorData1[row, col, layer].X, CellVectorData1[row, col, layer].Y, CellVectorData1[row, col, layer].Z * this.ZPointCoorScale);
                                        //vectorArray.InsertNextTuple4 (m,CellVectorData1[row, col, layer].X, CellVectorData1[row, col, layer].Y, CellVectorData1[row, col, layer].Z);

                                        m = m + 1;

                                    }

                                }

                            }
                        }

                    }

                    if (m <= 0)
                    {

                        //_unGrid.GetCellData().Reset();

                    }
                    else
                    {
                        //_unGrid.GetCellData().Reset();

                        _unGrid.GetPointData().SetVectors(vectorArray);
                        //_unGrid.GetCellData().SetVectors(vectorArray);

                        _unGrid.Modified();

                    }

                    if (this.vectorActor != null)
                    {
                        if (this.Visiability == true)
                        {
                            this.vectorActor.VisibilityOn();
                        }
                        else
                        {
                            this.vectorActor.VisibilityOff();
                        }
                    }

                }
                else
                {
                    _unGrid.GetPointData().Initialize();

                    this.vectorActor.VisibilityOff();

                }

            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("设置cell的向量数据 SetUnGridCellVectorData() 时出错！");
                return;
            }



        }


      /// <summary>
        ///  根据IBound的变化  更改Point  cell   VectorData
      /// </summary>
        private void SetUnGridIBound()
        {


            this.SetUnGridPointCellData();
           


        }

        /// <summary>
        /// 设置Point  Cell  VectorData
        /// </summary>
        private void SetUnGridPointCellData()
        {
          

            if (this._ibound == null)
            {
                return;
            }

            try
            {
                if (this._unGrid == null)
                {
                    this._unGrid = vtkUnstructuredGrid.New();
                }


                //int nLayer = this._hg.NLayers;
                //int nCol = this._hg.NCols ;
                //int nRow = this._hg.NRows ;
                //int nPts = nLayer * nCol * nRow;

                #region  构造数据集

                vtkPolyVertex aPolyVer = vtkPolyVertex.New();

                vtkFloatArray array = vtkFloatArray.New();
                array.SetNumberOfComponents(3);
                //array.SetNumberOfComponents(4);


                vtkFloatArray vectorArray = vtkFloatArray.New();
                vectorArray.SetNumberOfComponents(3);
                //vectorArray.SetNumberOfComponents(4);



                int m = 0;

                Coordinate coord;

                for (int layer = 0; layer < this.Ibound.Count; layer++)
                {
                    for (int row = 0; row < Ibound[layer].GetLength(0); row++)
                    {
                        for (int col = 0; col < Ibound[layer].GetLength(1); col++)
                        {

                            if (this.Ibound[layer][row, col] != 0)
                            {

                                coord = this._hg.Coords[row, col, layer];

                                array.InsertNextTuple3(coord.X, coord.Y, coord.Z);
                                //array.InsertNextTuple4(m, coord.X, coord.Y, coord.Z);

                                //aPolyVer.GetPointIds().SetId(m,m);
                                aPolyVer.GetPointIds().InsertId(m, m);
                                //aPolyVer.GetPointIds().InsertNextId ( m);


                                if (this._cellVectorData != null)
                                {
                                    vectorArray.InsertNextTuple3(CellVectorData1[row, col, layer].X, CellVectorData1[row, col, layer].Y, CellVectorData1[row, col, layer].Z * this.ZPointCoorScale);
                                    //vectorArray.InsertNextTuple4 (m,CellVectorData1[row, col, layer].X, CellVectorData1[row, col, layer].Y, CellVectorData1[row, col, layer].Z);
                                }


                                m++;

                            }

                        }

                    }
                }

                //array.SetNumberOfTuples(m);

                //aPolyVer.GetPointIds().SetNumberOfIds(m);

                vtkPoints pts = vtkPoints.New();

                pts.SetData(array);

                #endregion

                _unGrid.SetPoints(pts);

                _unGrid.InsertNextCell(aPolyVertex.GetCellType(), aPolyVer.GetPointIds());

                if (m <= 0)
                {
                    //_unGrid.GetCellData().Reset();

                    _unGrid.GetPointData().Initialize();

                }
                else
                {
                    if (this._cellVectorData != null)
                    {
                        _unGrid.GetPointData().SetVectors(vectorArray);
                    }

                }

                _unGrid.Modified();

            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("构建网格数据 SetUnGridPointCellData() 时出错！");

                return;
            }
    
        }




        private void SetVectorSetup()
        {

            if (this.arrowSource ==null )
            {
                return;
            }

            arrowSource.SetTipResolution(this.VectorSetup .TipResolution );
            arrowSource.SetTipRadius(this.VectorSetup.TipRadius );
            arrowSource.SetTipLength(this.VectorSetup .TipLength );
            arrowSource.SetShaftResolution(this.VectorSetup .ShaftResolution );
            arrowSource.SetShaftRadius(this.VectorSetup .ShaftRadius );

            if (this.vectorActor !=null )
            {
                this.vectorActor.GetProperty().SetColor(this.VectorSetup.Color.R / 255.0, this.VectorSetup.Color.G / 255.0, this.VectorSetup.Color.B / 255.0);
                
            }



            this.SetVectorModle();


            if (this.VectorSetup.IsShowVector == true)
            {
                this.Visiability = true;
            }
            else
            {
                this.Visiability = false ;
            
            }



            //if (this.vectorActor != null)
            //{
            //    if (this.VectorSetup.IsShowVector == false)
            //    {
            //        this.Visiability = false;
            //        //this.vectorActor.VisibilityOff();
            //    }
            //    else
            //    {
                    //this.Visiability = true;
                    //this.vectorActor.VisibilityOn();
            //    }
            //}
        



        }


        private void SetVectorModle()
        {

            if (glyph3d==null )
            {
                return;
            }


            if (this.VectorSetup.IsVaryLength == true)
            {
                //不定长
                #region 根据具体数据   有缩放


                //glyph3d.SetVectorModeToUseNormal();//使用点属性法线作为方向向量
                glyph3d.SetVectorModeToUseVector();//使用点属性向量作为方向向量

                //glyph3d.SetColorModeToColorByVector();


                //glyph3d.ClampingOn();


                //glyph3d.SetScaleModeToDataScalingOff();//会导致显示丢失  关闭缩放
                glyph3d.SetScaleModeToScaleByVector();//设置大小正比于向量长度
                //glyph3d.SetScaleModeToScaleByVectorComponents();
                //glyph3d.SetScaleModeToScaleByScalar();//设置大小正比于scalar

                glyph3d.OrientOn();

                glyph3d.SetScaleFactor(this.VectorSetup.ScaleRatio);




                #endregion


            }
            else
            {
                //定长

                #region 使用定长的向量  未解决

                glyph3d.SetVectorModeToUseVector();//使用点属性向量作为方向向量



                glyph3d.SetScaleModeToScaleByScalar();//设置大小正比于scalar


                glyph3d.SetScaleFactor(this.VectorSetup.TotalLength  );


                //glyph3d.SetScaleModeToDataScalingOff();//关闭缩放


                glyph3d.OrientOn();

                #region vtkGenericGlyph3DFilter
                //vtkGenericGlyph3DFilter geGlyph3d = vtkGenericGlyph3DFilter.New();
                //geGlyph3d.SetInput(_transformFilter.GetOutput());
                //geGlyph3d.SetSource(arrowSource.GetOutput());
                //geGlyph3d.SetVectorModeToUseVector();
                //geGlyph3d.SetVectorModeToUseNormal();
                //geGlyph3d.SetScaleModeToDataScalingOff();//关闭缩放
                //geGlyph3d.SetScaleModeToScaleByVector();//
                //geGlyph3d.SetScaleModeToScaleByVectorComponents();
                //geGlyph3d.OrientOff();
                ////glyph3d.OrientOn();
                //geGlyph3d.SetScaleFactor(40);

                #endregion


                #endregion

            }


       

         

        
        
        
        }









        #endregion


        #region 公用方法


        /// <summary>
        /// 更新 IBound 和 CellVector 防止在外围赋值时两者都要调用对应的更新操作降低效率
        /// </summary>
        /// <param name="gridCellScalar"></param>
        /// <param name="iBound"></param>
        public void UpdateIBoundAndVectorData(Vector [,,] gridCellVector, List<int[,]> iBound)
        {
            if ( iBound == null )
            {
                return;
            }


            this._cellVectorData = gridCellVector;//字段不会触发更新操作
            //this.ContourData = gridCellScalar;//属性会触发更新操作


            if (this.vectorActor != null)
            {

                if (gridCellVector != null && this.Visiability == true)
                {
                    this.vectorActor.VisibilityOn();
                }
                else
                {
                    this.vectorActor.VisibilityOff ();
                }

            }


            this.Ibound  = iBound;//属性触发更新操作


        }


        //public void UpdateTransformScale(Vector newScaleVector)
        //{

        //    this.ScaleVector = newScaleVector;

        //    //this.scaleVector.X = newScaleVector.X;
        //    //this.scaleVector.Y = newScaleVector.Y;
        //    //this.scaleVector.Z = newScaleVector.Z;


        //    //if (this._transform != null)
        //    //{
        //    //    this._transform.Identity();
        //    //    this._transform.Scale(this.scaleVector.X, this.scaleVector.Y, this.scaleVector.Z);
               

        //    //}

        //}

        public void UpdateArrowSourceGlyph3dFilter()
        {

            this.SetVectorSetup();
        
        }

        public void UpdateVectorVisibility(bool isVisible)
        {

            this.VectorSetup .UpdateVectorVisibility (isVisible);

            //触发Actor可见性的判断更新
            if (this.VectorSetup .IsShowVector )
            {
                this.Visiability = true;
            }
            else
            {
                this.Visiability = false;
            }
        
        }

        #endregion


     


        #region Filter属性重写


        protected override void OnSetVisibility()
        {
            base.OnSetVisibility();


            if (this.ParentNode.Scene == null)
            {
                return;

            }

            if (this.ParentNode.Scene.IsRendering)
            {
                if (this._visiability && this.CellVectorData1 !=null )
                {
                    this.vectorActor .VisibilityOn();
                 
                }
                else
                {
                    this.vectorActor.VisibilityOff();
                  
                }

              
            }



        }

        protected override void OnSetRepresentationType()
        {
            base.OnSetRepresentationType();

            if (this.ParentNode.Scene == null)
            {
                return;

            }

            if (this.ParentNode.Scene.IsRendering)
            {
                if (this._repType == REPRESENTATIONTYPE.POINT)
                {
               
                }
                else if (this._repType == REPRESENTATIONTYPE.SURFACE)
                {
                  
                }
                else
                {
                  
                }

               
            }

        }

        protected override void OnSetContourType()
        {
            base.OnSetContourType();



        }




        #endregion

    }
}
